<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>登录--layui后台管理模板</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="../../layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="../../css/login.css" media="all"/>
</head>
<body>
<video class="video-player" preload="auto" autoplay="autoplay" loop="loop" data-height="1080" data-width="100%"  width="100%"
       height="1080" width="1920">
    <source src="login.mp4" type="video/mp4">
</video>
<div class="video_mask"></div>
<div class="login">
    <h1>layuiCMS-管理登录</h1>
    <form class="layui-form">
        <div class="layui-form-item">
            <input class="layui-input" name="username" placeholder="用户名" lay-verify="required" type="text"
                   autocomplete="off">
        </div>
        <div class="layui-form-item">
            <input class="layui-input" name="passwords" placeholder="密码" lay-verify="required" type="password"
                   autocomplete="off">
        </div>

        <button class="layui-btn login_btn" lay-submit="" lay-filter="login">登录</button>
    </form>
</div>
<script type="text/javascript" src="../../layui/layui.js"></script>

<script>
    layui.config({
        base: "js/"
    }).use(['form', 'layer'], function () {
        var form = layui.form(),
            layer = parent.layer === undefined ? layui.layer : parent.layer,
            $ = layui.jquery;
        //video背景
        $(window).resize(function () {
            if ($(".video-player").width() > $(window).width()) {
                $(".video-player").css({
                    "height": $(window).height(),
                    "width": "auto",
                    "left": -($(".video-player").width() - $(window).width()) / 2
                });
            } else {
                $(".video-player").css({
                    "width": $(window).width(),
                    "height": "auto",
                    "left": -($(".video-player").width() - $(window).width()) / 2
                });
            }
        }).resize();

        //登录按钮事件
        form.on("submit(login)", function (data) {
            var  pwd=document.getElementsByName("passwords")[0].value;
            var userid=   document.getElementsByName("username")[0].value
            $.ajax({
                url: "http://localhost:8080/com.3group.personality/admin/adminLogin?adminid=" +userid+"&pwd="+pwd,
                type: "get",
                dataType: "text",
                success: function (datas) {
                    var json = eval('(' + datas + ')');
                    if (datas=="error" ) {
                        alert(datas)

                    } else  {
                        console.log(json)
                        // var e = JSON.stringify(datas)
                        sessionStorage.setItem("userInfo",datas);
                        window.location.href = "../../index.html";



                    }

                }
            })
            return false;
        })
    })

</script>


<!--	<script type="text/javascript" src="login.js"></script>-->
</body>
</html>